# nested dictionary
dict2 = {
    'Name':
        {
            'first_name': 'Steve',
            'Last_name': 'Jobs'
        },
    'Age': 30,
    'Designation': 'Programmer',
    'address':
        {
            'Street':
                {
                    'st_number': 4,
                    'st_name': 'Rockins Road'
                },
            'City': 'Bangalore',
            'Country': 'India'
        }
}


# we use recursive function to count
# length of nested dictionaries
def count_nested_len(d):
    length = 0

    for key, value in d.items():
        if not isinstance(value, list):
            length += 1
        else:
            length += len(value)
    return length


print("Nested dictionary length:",
      count_nested_len(dict2))
